package com.wanxi.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author Li
 * @Date 2023/4/25 17:39
 */
@WebServlet("/d")
public class DataServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//        设置乱码
//        得到前端的值
        String username = req.getParameter("username");
//        将值存入到req
        req.setAttribute("username",username);
//        将数据转发到页面
        req.getRequestDispatcher("/index.jsp").forward(req,resp);


    }
}
